/**  
* @Title: BaseServiceImpl.java
* @Package com.test.service.base
* @Description: TODO
* @author daiji  
* @date 2015-9-6 下午4:05:31
* @version V1.0  
*/
package base.service;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import javax.annotation.Resource;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Service;
import base.dao.IBaseDao;
import base.entity.Page;

@Service("baseServiceImpl")
public class BaseServiceImpl implements IBaseService{
	
	@Resource
	private IBaseDao baseDaoImpl;
	
	public BaseServiceImpl() {
		//System.out.println("---create BaseServiceImpl---");
	}
	
	public <T> T save(T t) throws Exception{
		return baseDaoImpl.save(t);
	}

	public <T> T saveOrUpdate(T t) throws Exception{
		return baseDaoImpl.saveOrUpdate(t);
	}

	public <T> List<T> save(Collection<T> list) throws Exception{
		return baseDaoImpl.save(list);
	}

	public int delete(Object t) throws Exception{
		return baseDaoImpl.delete(t);
	}

	@SuppressWarnings("rawtypes")
	public int delete(Class c, Object id) throws Exception{
		return baseDaoImpl.delete(c, id);
	}
	
	@SuppressWarnings("rawtypes")
	public int delete(Collection list) throws Exception{
		return baseDaoImpl.delete(list);
	}

	public <T> T getById(Class<T> c, Serializable id) throws Exception{
		return baseDaoImpl.getById(c, id);
	}

	public <T> T findOne(String hql, Object[] params) throws Exception{
		return baseDaoImpl.findOne(hql, params);
	}

	@SuppressWarnings("rawtypes")
	public <T> List<T> getByIdList(Class<T> c, Collection ids) throws Exception{
		return baseDaoImpl.getByIdList(c, ids);
	}

	public <T> List<T> get(Class<T> c) {
		return baseDaoImpl.get(c);
	}

	public <T> List<T> find(String hql, Object[] params) throws Exception {
		return baseDaoImpl.find(hql, params);
	}

	public <T> Page<T> find(String hql, Object[] params, int pageNo,
			int pageSize) throws Exception {
		return baseDaoImpl.find(hql, params, pageNo, pageSize);
	}

	public long countHql(String hql, Object[] params) throws Exception {
		return baseDaoImpl.countHql(hql, params);
	}
	
	public int executeHql(String hql, Object[] params) throws Exception {
		return baseDaoImpl.executeHql(hql, params);
	}

	public <T> List<T> findByCriteria(DetachedCriteria criteria)
			throws Exception {
		return baseDaoImpl.findByCriteria(criteria);
	}

	public <T> Page<T> findByCriteria(DetachedCriteria criteria,
			Integer pageNo, Integer pageSize) throws Exception {
		return baseDaoImpl.findByCriteria(criteria, pageNo, pageSize);
	}


}
